package com.cloud.lucene.controller;

import com.cloud.lucene.domain.BookContent;
import com.cloud.lucene.service.LuceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@RestController
public class LuceneController {


    @Autowired
    LuceneService luceneService;

    @RequestMapping("/createIndex")
    public String createIndex() throws IOException {
        List<BookContent> list1 = new ArrayList<>();
        list1.add(new BookContent(null,"Java面向对象", 10d, null, "Java面向对象从入门到精通,简单上手"));
        list1.add(new BookContent(null,"Java面向对象java", 10d, null, "Java面向对象从入门到精通,简单上手"));
        list1.add(new BookContent(null,"Java面向编程", 15d, null, "Java面向对象编程书籍"));
        list1.add(new BookContent(null,"JavaScript入门", 18d, null, "JavaScript入门编程书籍"));
        list1.add(new BookContent(null,"深入理解Java编程", 13d, null, "十三四天掌握Java基础"));
        list1.add(new BookContent(null,"从入门到放弃_Java", 20d, null, "一门从入门到放弃的书籍"));
        list1.add(new BookContent(null,"Head First Java", 30d, null, "《Head First Java》是一本完整地面向对象(object-oriented，OO)程序设计和Java的学习指导用书"));
        list1.add(new BookContent(null,"Java 核心技术：卷1 基础知识", 22d, null, "全书共14章，包括Java基本的程序结构、对象与类、继承、接口与内部类、图形程序设计、事件处理、Swing用户界面组件"));
        list1.add(new BookContent(null,"Java 编程思想", 12d, null, "本书赢得了全球程序员的广泛赞誉，即使是最晦涩的概念，在Bruce Eckel的文字亲和力和小而直接的编程示例面前也会化解于无形"));
        list1.add(new BookContent(null,"Java开发实战经典", 51d, null, "本书是一本综合讲解Java核心技术的书籍，在书中使用大量的代码及案例进行知识点的分析与运用"));
        list1.add(new BookContent(null,"Effective Java", 10d, null, "本书介绍了在Java编程中57条极具实用价值的经验规则，这些经验规则涵盖了大多数开发人员每天所面临的问题的解决方案"));
        list1.add(new BookContent(null,"分布式 Java 应用：基础与实践", 14d, null, "本书介绍了编写分布式Java应用涉及的众多知识点，分为了基于Java实现网络通信、RPC;基于SOA实现大型分布式Java应用"));
        list1.add(new BookContent(null,"http权威指南", 11d, null, "超文本传输协议(Hypertext Transfer Protocol，HTTP)是在万维网上进行通信时所使用的协议方案"));
        list1.add(new BookContent(null,"Spring", 15d, null, "这是啥，还需要学习吗？Java程序员必备书籍"));
        list1.add(new BookContent(null,"深入理解 Java 虚拟机", 18d, null, "作为一位Java程序员，你是否也曾经想深入理解Java虚拟机，但是却被它的复杂和深奥拒之门外"));
        list1.add(new BookContent(null,"springboot实战", 11d, null, "完成对于springboot的理解，是每个Java程序员必备的姿势"));
        list1.add(new BookContent(null,"springmvc学习", 72d, null, "springmvc学习指南"));
        list1.add(new BookContent(null,"vue入门到放弃", 20d, null, "vue入门到放弃书籍信息"));
        list1.add(new BookContent(null,"vue入门到精通", 20d, null, "vue入门到精通相关书籍信息"));
        list1.add(new BookContent(null,"vue之旅", 20d, null, "由浅入深地全面介绍vue技术，包含大量案例与代码"));
        list1.add(new BookContent(null,"vue实战", 20d, null, "以实战为导向，系统讲解如何使用 "));
        list1.add(new BookContent(null,"vue入门与实践", 30d, null, "现已得到苹果、微软、谷歌等主流厂商全面支持"));
        list1.add(new BookContent(null,"Vue.js应用测试", 20d, null, "Vue.js创始人尤雨溪鼎力推荐！Vue官方测试工具作者亲笔撰写，Vue.js应用测试完全学习指南"));
        list1.add(new BookContent(null,"PHP和MySQL Web开发", 20d, null, "本书是利用PHP和MySQL构建数据库驱动的Web应用程序的权威指南"));
        list1.add(new BookContent(null,"Web高效编程与优化实践", 20d, null, "从思想提升和内容修炼两个维度，围绕前端工程师必备的前端技术和编程基础"));
        list1.add(new BookContent(null,"Vue.js 2.x实践指南", 20d, null, "本书旨在让初学者能够快速上手vue技术栈，并能够利用所学知识独立动手进行项目开发"));
        list1.add(new BookContent(null,"初始vue", 20d, null, "解开vue的面纱"));
        list1.add(new BookContent(null,"什么是vue", 2d, null, "一步一步的了解vue相关信息"));
        list1.add(new BookContent(null,"深入浅出vue", 20d, null, "深入浅出vue，慢慢掌握"));
        list1.add(new BookContent(null,"三天vue实战", 20d, null, "三天掌握vue开发"));
        list1.add(new BookContent(null,"不知火舞", 20d, null, "不知名的vue"));
        list1.add(new BookContent(null,"娜可露露", 20d, null, "一招秒人"));
        list1.add(new BookContent(null,"宫本武藏", 20d, null, "我就是一个超级兵"));
        list1.add(new BookContent(null,"vue宫本vue", 20d, null, "我就是一个超级兵"));

        luceneService.createIndex(list1);
        return"success";
    }










}
